import request from '@/utils/request'

// 查询投资回款列表
export function listDealDistribution(query) {
  return request({
    url: '/distribution/dealDistribution/list',
    method: 'get',
    params: query
  })
}

// 查询投资回款列表合计
export function getDealDistributionSum(query) {
  return request({
    url: '/distribution/dealDistribution/getSum',
    method: 'get',
    params: query
  })
}

// 查询投资回款详细
export function getDealDistribution(id) {
  return request({
    url: '/distribution/dealDistribution/' + id,
    method: 'get'
  })
}

export function updateTimeMoney(data) {
  return request({
    url: '/distribution/dealDistribution/updateTimeMoney',
    method: 'post',
    data: data
  })
}

// 保存投资回款
export function saveDealDistribution(data) {
  return request({
    url: '/distribution/dealDistribution/save',
    method: 'post',
    data: data
  })
}

// 删除投资回款
export function delDealDistribution(id) {
  return request({
    url: '/distribution/dealDistribution/' + id,
    method: 'delete'
  })
}

// 导出投资回款
export function exportDealDistribution(query) {
  return request({
    url: '/distribution/dealDistribution/export',
    method: 'get',
    params: query
  })
}

// 获取当前项目的投资主体
export function getInvestment(dealId) {
  return request({
    url: '/distribution/dealDistribution/getInvestment',
    method: 'post',
    data: { 'dealId': dealId }
  })
}

// 获取当前投资回款的收益主体列表
export function getDistributionDetails(query) {
  return request({
    url: '/distribution/dealDistribution/getDistributionDetails',
    method: 'post',
    data: { 'distributionId': query }
  })
}

// 获取项目投资回款信息
export function getDistributionDetailsStatistics(query) {
  return request({
    url: '/distribution/dealDistribution/getDistributionDetailsStatistics',
    method: 'get',
    params: query
  })
}

// 根据 年份 季度 项目ID查询
export function findByDateAndDealId(query) {
  return request({
    url: '/distribution/dealDistribution/findByDateAndDealId',
    method: 'get',
    params: query
  })
}

export function deleteByIdToSubDetails(id) {
  return request({
    url: '/distribution/dealDistribution/deleteByIdToSub/' + id,
    method: 'delete'
  })
}

export function deleteByIdToPayment(id) {
  return request({
    url: '/distribution/dealDistribution/deleteByIdToPayment/' + id,
    method: 'delete'
  })
}

export function deleteDetailsById(id) {
  return request({
    url: '/distribution/dealDistribution/deleteDetailsById/' + id,
    method: 'delete'
  })
}
